// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'

import App from './App'
import router from './router'
import store from './store'
import iView from 'iview'
import 'iview/dist/styles/iview.css'
import axios from 'axios'
import VueAMap from 'vue-amap'

Vue.config.productionTip = false
Vue.prototype.$http = axios
axios.defaults.headers.post['Content-Type'] = 'application/json'
axios.defaults.headers.post['X-Requested-With'] = 'XMLHttpRequest'
axios.defaults.withCredentials = true
Vue.use(iView)
Vue.use(VueAMap)

// a map init
VueAMap.initAMapApiLoader({
  // 高德的key
  key: 'b5c958bb18ef66d6aeffe4915fff6a8f',
  // 插件集合
  plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor']
})

/* Vue.use(N3Components) */

router.beforeEach((to, from, next) => {
  window.document.title = to.meta.title
  next()
})
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: { App }
})
